<template>
  <div class="live_content">
    <div class="live_item" v-for="item in livecontent" :key="item.id"  @click="toDetil(item.id)">
      <div class="live_l" v-if="item.banner">
        <img :src="'https://ss.lanqb.com/' + item.banner"/>
        <span></span>
      </div>
      <div class="live_l" v-else>
        <img :src="'https://ss.lanqb.com/' + item.posters.banner"/>
        <span></span>
      </div>
      <div class="live_r">
        <div class="r_t">
          <h3>{{ item.title }}</h3>
        </div>
        <div class="r_m" v-if="item.profile">
          <img :src="'https://ss.lanqb.com/' + item.profile.avatar" />
          <span>{{ item.profile.nickname }}</span>
        </div>
        <div class="r_b">
          <span>时间：{{ item.begin_at }}</span>
          <span>{{ item.statistic.purchases }}人感兴趣</span>
        </div>
      </div>

      <div class="button">
        <span>预约直播</span>
      </div>
      <em>第{{item.periods}}期</em>
    </div>
  </div>
</template>

<script>

export default {
  name: "LiveContent",
  props: ["livecontent"],
  data() {
    return {};
  },
  created() {
   
  },
  mounted() {},

  methods: {
     toDetil(id){
     this.$router.push(`/daniuCourse/${id}`);
     this.$store.commit('setBar',false);
    }
  },
};
</script>

<style lang="scss" scoped>
.button {
  position: absolute;
  right: 30px;
  bottom: 1px;
  width: 64px;
  height: 23px;
  font-size: 11px;
  text-align: center;
  line-height: 23px;
  border-radius: 25px;
  color: #634b19;
  background: #edce8c;
  background-image: linear-gradient(180deg, #f7e9c0, #edce8c);
}
.live_content {
  width: 90vw;
  margin: auto;
  .live_item {
    position: relative;
    width: 90vw;
    background-color: white;
    margin: 15px 0;
    border-radius: 5px;
    height: 133px;
    display: flex;
    align-items: center;
    em {
      position: absolute;
      left: 10px;
      top: 16px;
      z-index: 1;
      display: inline-block;
      color: #fff;
      background-color: rgba(0, 0, 0, 0.4);
      line-height: 13px;
      white-space: nowrap;
      font-size: 12px;
      padding:2px 5px;
      border-radius: 14px;
    }
    .live_l {
      margin: 3px;
      img {
        width: 149px;
        border-radius: 5px;
        height: 112px;
      }
    }
    .live_r {
      display: flex;
      flex-direction: column;
      justify-content: space-around;

      .r_t {
        h3 {
          font-size: 16px;
          font-weight: 700;
          margin-bottom: 11px;
        }
      }
      .r_m {
        display: flex;
        align-items: center;
        img {
          width: 25px;
          height: 25px;
          border-radius: 50%;
          margin: 5px;
        }
      }
      .r_b {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        span {
          color: #8c8c8c;
          margin-top: 10px;
          font-size: 12px;
        }
      }
    }
  }
}
</style>
